package com.ttmusic.activitys;

import java.util.ArrayList;
import java.util.List;

import com.ttmusic.fragments.guide.DepthPageTransformer;
import com.ttmusic.fragments.guide.Guide1;
import com.ttmusic.fragments.guide.Guide2;
import com.ttmusic.fragments.guide.Guide3;
import com.ttmusic.fragments.guide.Guide4;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;

/**
 * app引导动画  第一次运行App时会运行这个Activity
 * 吴昌勇添加代码，测试提交2018-11-09啊啊啊啊啊啊
 * @author wuchangyong
 *
 */
public class GuideActivity extends FragmentActivity {
	
	private List<Fragment> guides;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);  
		setContentView(R.layout.activity_guide);
		
		ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);  
		this.guides = new ArrayList<Fragment>();
		this.guides.add(new Guide1());
		this.guides.add(new Guide2());
		this.guides.add(new Guide3());
		this.guides.add(new Guide4());
		FragmentPagerAdapter adapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
			@Override
			public int getCount() {
				return GuideActivity.this.guides.size();
			}
			@Override
			public Fragment getItem(int index) {
				return GuideActivity.this.guides.get(index);
			}
		};
		viewPager.setPageTransformer(true, new DepthPageTransformer());
		viewPager.setAdapter(adapter);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		//getMenuInflater().inflate(R.menu.guide, menu);
		return false;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.
		int id = item.getItemId();
		if (id == R.id.action_settings) {
			return true;
		}
		return super.onOptionsItemSelected(item);
	}

}
